<template>
    <x-page class="page-note-list" title="笔记列表">
        <template slot="main">
            <cube-scroll ref="scroll" class="opportunity-list" :options="options"
                         :data="list"
                         @pulling-down="onPullingDown"
                         @pulling-up="onPullingUp">
                <div class="list-wrap">
                    <template v-for="(item, index) in formattedList">
                        {{item}}
                    </template>
                    <div class="no-more" v-if="!hasNext">没有更多了</div>
                </div>
            </cube-scroll>
        </template>
    </x-page>
</template>

<script>
import XPage from '../../components/XPage';
import { ListCrud } from 'src/mobile/crud';
import API from 'src/api/repository/notes';
import Loading from 'src/mobile/loading';

export default {
    components: { XPage },
    data() {
        return {
            ...ListCrud.data()
        };
    },
    computed: {
        formattedList() {
            let formattedData = [];
            this.list.forEach((item) => {
                formattedData.push({
                    ...item
                });
            });
            return formattedData;
        }
    },
    mounted() {
        this.getPage();
    },
    methods: {
        ...ListCrud.methods(API, 'notes'),
    }
};
</script>

<style scoped>

</style>